<?php
include "../Service/recruitmentsService.php";
if(isset($_GET["action"]) && $_GET["action"] == "searchAjax"){
    $search['major'] = $_GET["major"];
    $search['degree'] = $_GET["degree"];
    $search['location'] = $_GET["location"];
    $search['position'] = $_GET["position"];
    $result = searchRecruiment($search);
    $n = 0;
    /*$show = "<table style='border: 1px solid; width:1000px'>";
    $show .= "<tr><td style='border: 1px solid;'>Mo Ta Tin Tuyen Dung</td>";
    $show .= "<td style='border: 1px solid;'>Nganh Nghe</td>";
    $show .= "<td style='border: 1px solid;'>Vi Tri</td>";
    $show .= "<td style='border: 1px solid;'>Bang Cap</td>";
    $show .= "<td style='border: 1px solid;'>Dia Diem</td></tr>";*/
    $show = '<table class="listing" cellpadding="0" cellspacing="0">
                                <tr>
    						<th class="first" width="177">Cong viec</th>
                            <th>Mo ta</th>
                            <th>Nganh Nghe</th>
                            <th>Vi tri tuyen dung</th>
                            <th>Bang Cap yeu cau</th>
                            <th class="last">Dia Diem</th>
                            </tr>';
    while($row = mysql_fetch_array($result))
    {
        /*$show .= "<tr><td style='border: 1px solid;'>".$row['RECRUITMENT_DESCRIPTION']." </td>";
        $show .= "<td style='border: 1px solid;'>".$row['MAJOR_TITLE']." </td>";
        $show .= "<td style='border: 1px solid;'>".$row['POSITION_TITLE']." </td>";
        $show .= "<td style='border: 1px solid;'>".$row['DEGREE_TITLE']." </td>";
        $show .= "<td style='border: 1px solid;'>".$row['JOB_LOC_NAME']." </td></tr>";*/
        $n++;

        $show .= "<tr><td class='first style2'>".$row['RECRUITMENT_NAME']."</td>";
        $show .= "<td class='first style2'>".$row['RECRUITMENT_DESCRIPTION']."</td>";
        $show .= "<td class='first style2'>".$row['MAJOR_TITLE']."</td>";
        $show .= "<td class='first style2'>".$row['POSITION_TITLE']."</td>";
        $show .= "<td class='first style2'>".$row['DEGREE_TITLE']."</td>";
        $show .= "<td class='first style2'>".$row['JOB_LOC_NAME']."</td>";
    
    }
    if($n == 0)
        echo '<span style="color: red;">Khong tim thay du lieu</span>';
    else
        echo $show."</table>";
}
?>